a11y: Remove index from cellaccessible
authorBenjamin Otte <otte@redhat.com>
Fri, 11 Nov 2011 02:02:31 +0000 (03:02 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 16 Nov 2011 03:39:22 +0000 (04:39 +0100)
That way we also get rid of the refresh_index function.

gtk/a11y/gtkcellaccessible.c
gtk/a11y/gtkcellaccessible.h
gtk/a11y/gtkcontainercellaccessible.c
gtk/a11y/gtktreeviewaccessible.c

index c68ff271259b9e067fa7996d429c5083563fbb41..fdccd19ae41a91caaa337d287ece36d059f423e8 100644 (file)
@@ -92,7 +92,6 @@ gtk_cell_accessible_get_index_in_parent (AtkObject *obj)
 {
   GtkCellAccessible *cell;
   AtkObject *parent;
-  int index;
 
   cell = GTK_CELL_ACCESSIBLE (obj);
 
@@ -104,18 +103,7 @@ gtk_cell_accessible_get_index_in_parent (AtkObject *obj)
   if (parent == NULL)
     return -1;
 
-  index = _gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
-  if (index >= 0)
-    return index;
-
-  if (atk_state_set_contains_state (cell->state_set, ATK_STATE_STALE) &&
-      cell->refresh_index != NULL)
-    {
-      cell->refresh_index (cell);
-      atk_state_set_remove_state (cell->state_set, ATK_STATE_STALE);
-    }
-
-  return cell->index;
+  return _gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
 }
 
 static AtkStateSet *
@@ -145,8 +133,6 @@ _gtk_cell_accessible_init (GtkCellAccessible *cell)
 {
   cell->widget = NULL;
   cell->action_list = NULL;
-  cell->index = 0;
-  cell->refresh_index = NULL;
   cell->state_set = atk_state_set_new ();
   atk_state_set_add_state (cell->state_set, ATK_STATE_TRANSIENT);
   atk_state_set_add_state (cell->state_set, ATK_STATE_ENABLED);
@@ -164,12 +150,10 @@ widget_destroyed (GtkWidget         *widget,
 void
 _gtk_cell_accessible_initialise (GtkCellAccessible *cell,
                                  GtkWidget         *widget,
-                                 AtkObject         *parent,
-                                 gint               index)
+                                 AtkObject         *parent)
 {
   cell->widget = widget;
   atk_object_set_parent (ATK_OBJECT (cell), parent);
-  cell->index = index;
 
   g_signal_connect_object (G_OBJECT (widget), "destroy",
                            G_CALLBACK (widget_destroyed), cell, 0);
index 234ca7d3dd04cb7a280d12cd00076c1d2a6ca707..ceab22295862f991c6467f2c29f63120a4455783 100644 (file)
@@ -39,13 +39,8 @@ struct _GtkCellAccessible
   AtkObject parent;
 
   GtkWidget    *widget;
-  /* This cached value is used only by atk_object_get_index_in_parent()
-   * which updates the value when it is stale.
-   */
-  gint         index;
   AtkStateSet *state_set;
   GList       *action_list;
-  void (*refresh_index) (GtkCellAccessible *cell);
 };
 
 struct _GtkCellAccessibleClass
@@ -57,8 +52,7 @@ GType    _gtk_cell_accessible_get_type      (void);
 
 void     _gtk_cell_accessible_initialise    (GtkCellAccessible *cell,
                                              GtkWidget         *widget,
-                                             AtkObject         *parent,
-                                             gint               index);
+                                             AtkObject         *parent);
 gboolean _gtk_cell_accessible_add_state     (GtkCellAccessible *cell,
                                              AtkStateType       state_type,
                                              gboolean           emit_signal);
index d2f577d938bd90f292d7e91631da747b3d045c34..6232249dd13ddf33e57efbf6b9b6b4849bd34425 100644 (file)
@@ -100,14 +100,11 @@ void
 _gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container,
                                           GtkCellAccessible          *child)
 {
-  gint child_index;
-
   g_return_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container));
   g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child));
 
-  child_index = container->NChildren++;
+  container->NChildren++;
   container->children = g_list_append (container->children, child);
-  child->index = child_index;
   atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (container));
 }
 
index 0445c34faf9330b25ecb66782350d14f2590e04a..1b6167f25974c751bf56b19a70fe414fb45f436a 100644 (file)
@@ -566,7 +566,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
       container = _gtk_container_cell_accessible_new ();
 
       container_cell = GTK_CELL_ACCESSIBLE (container);
-      _gtk_cell_accessible_initialise (container_cell, widget, ATK_OBJECT (accessible), i);
+      _gtk_cell_accessible_initialise (container_cell, widget, ATK_OBJECT (accessible));
 
       /* The GtkTreeViewAccessibleCellInfo structure for the container will
        * be before the ones for the cells so that the first one we find for
@@ -596,7 +596,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
       /* Create the GtkTreeViewAccessibleCellInfo structure for this cell */
       cell_info_new (accessible, tree_model, path, tv_col, cell);
 
-      _gtk_cell_accessible_initialise (cell, widget, parent, i);
+      _gtk_cell_accessible_initialise (cell, widget, parent);
 
       /* Set state if it is expandable */
       if (is_expander)
@@ -630,7 +630,7 @@ gtk_tree_view_accessible_ref_child (AtkObject *obj,
           /* Create the GtkTreeViewAccessibleCellInfo for this cell */
           cell_info_new (accessible, tree_model, path, tv_col, cell);
 
-          _gtk_cell_accessible_initialise (cell, widget, parent, i);
+          _gtk_cell_accessible_initialise (cell, widget, parent);
 
           if (container)
             _gtk_container_cell_accessible_add_child (container, cell);